# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@com_google_maldoca//:bazel/variables.bzl", "DEFAULT_MALDOCA_COPTS")

licenses(["notice"])

package(
    default_visibility = ["//:__subpackages__"],
)

cc_library(
    name = "protocol-buffer-matchers",
    testonly = 1,
    srcs = ["protocol-buffer-matchers.cc"],
    hdrs = ["protocol-buffer-matchers.h"],
    copts = DEFAULT_MALDOCA_COPTS,
    deps = [
        "//maldoca/base:logging",
        "@com_google_absl//absl/strings",
        "@com_google_googletest//:gtest",
        "@com_google_protobuf//:protobuf",
        "@com_googlesource_code_re2//:re2",
    ],
)

cc_library(
    name = "status_matchers",
    testonly = 1,
    hdrs = ["status_matchers.h"],
    copts = DEFAULT_MALDOCA_COPTS,
    deps = select({
        "//conditions:default": [
            "@com_google_zetasql//:status_matchers",
        ],
        "//:chrome_build": [
            "//maldoca/base:status",
            "@com_google_absl//absl/base",
            "@com_google_absl//absl/memory",
            "@com_google_absl//absl/status",
            "@com_google_absl//absl/status:statusor",
            "@com_google_absl//absl/types:any",
            "@com_google_absl//absl/utility",
            "@com_google_googletest//:gtest",
        ],
    }),
)

cc_library(
    name = "test_utils",
    testonly = 1,
    hdrs = ["test_utils.h"],
    copts = DEFAULT_MALDOCA_COPTS,
    deps = [
        "//maldoca/base:get_runfiles_dir",
        "//maldoca/base:file",
        "@com_google_absl//absl/strings",
    ],
)

cc_test(
    name = "status_matchers_test",
    size = "small",
    srcs = ["status_matchers_test.cc"],
    copts = DEFAULT_MALDOCA_COPTS,
    deps = [
        ":status_matchers",
        "//maldoca/base:status",
        "@com_google_googletest//:gtest",
        "@com_google_googletest//:gtest_main",
    ],
)
